<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="icon" type="image/png" href="${pageContext.request.contextPath}/images/favicon.ico">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

	<title>修改类目</title>

	<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
    <meta name="viewport" content="width=device-width" />


    <!-- Bootstrap core CSS     -->
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet" />

    <!-- Animation library for notifications   -->
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet"/>

    <!--  Light Bootstrap Table core CSS    -->
    <link href="${pageContext.request.contextPath}/css/light-bootstrap-dashboard.css" rel="stylesheet"/>


    <!--  CSS for Demo Purpose, don't include it in your project     -->
    <link href="${pageContext.request.contextPath}/css/demo.css" rel="stylesheet" />


    <!--     Fonts and icons     -->
    <link href="${pageContext.request.contextPath}/css/pe-icon-7-stroke.css" rel="stylesheet" />
    
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.10.2.js"></script>

    <!--上传类目banner图回显-->
   <link href="${pageContext.request.contextPath}/css/uploadFile.css" rel="stylesheet">
   <script src="${pageContext.request.contextPath}/js/uploadFile.js"></script>
    
    <script type="text/javascript">
        $(function () {
            if("${empty category.image}"=="true"){
                $(".img").attr("style","opacity: 0");
            }

            $("[name='type']").change(function () {
                if($("[name='type']").val()!="${category.type}"){
                    $.notify({
                        icon: 'pe-7s-gift',
                        message: " <b>修改类目类型会同时修改二级类目，请谨慎操作!</b>"

                    },{
                        type: 'warning',
                        timer: 4000
                    });
                }

            })
        })
        function sub() {
            if($("[name='csname']").val()==""){
                alert("请填写类目名称")
                return false;
            }
            if($("[name='sort']").val()==""){
                alert("请填写类目优先级")
                return false;
            }
            if($("[name='type']").val()==-1){
                alert("请选择类目类型")
                return false;
            }
            if($("[name='type']").val()!="${category.type}"){
                $("[name='changeType']").val(true);
            }
            return true;
        }
    </script>
    
</head>
<body>

<div class="wrapper">
    


	
   <%@include file="./include/left.jsp"%>
    
    
    <div class="main-panel">
    	
         <%@include file="./include/nav.jsp"%>

		<div class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-8" style="width: 800px">
                        <div class="card">
                            <div class="header">
                                <h4 class="title">修改类目</h4>
                            </div>
                            <div class="content">
                                <form action="${pageContext.request.contextPath}/category/updateCategory.html" method="post" enctype="multipart/form-data" onsubmit="return sub()">
                                    <input type="hidden" name="id" value="${category.id}">
                                    <input type="hidden" name="prevPath" value="${category.image}">
                                    <input type="hidden" name="changeType" value="false">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <div class="form-group">
                                                <label>类目名称</label>
                                                <input type="text" class="form-control" name="cname" value="${category.cname}">
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <label>类型</label>
                                                <select name="type" class="form-control">
                                                <option value="0" ${category.type==0?"selected":""}>产品</option>
                                                <option value="1" ${category.type==1?"selected":""}>新闻</option>
                                                </select>

                                            </div>
                                        </div>
                                        <div class="col-md-4">
                                            <div class="form-group">
                                                <label>类别优先级</label>
                                                <input type="number"  min="1"  name="sort" class="form-control" value="${category.sort}">
                                                <!-- <input type="email" class="form-control" placeholder="Email"> -->
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group" style="width: 650px">
                                                <label>宣传语1</label>
                                                <input type="text" class="form-control" id="publicityOne" placeholder="宣传语1" name="publicityOne" value="${category.publicityOne} ">
                                            	<span id="recMsg"></span>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group" style="width: 650px">
                                                <label>宣传语2</label>
                                                <input type="text" class="form-control" placeholder="宣传语2" name="publicityTwo" value="${category.publicityTwo}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">

                                        <label style="margin-left: 13px">类目banner图片</label>
                                        <div class="lccid" style="margin-left: 3px">

                                            <p class="img-title">
                                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                                                类目banner</p>
                                                <img src="${pageContext.request.contextPath}${category.image}"  class="img">
                                                <input type="file" name="pic" class="file" placeholder="ICCID" accept="image/*" capture="camera">
                                        </div>
                                    <button type="submit" class="btn btn-info btn-fill pull-right">修改</button>
                                    <div class="clearfix"></div>
                                </form>
                            </div>
                        </div>
                    </div>
                    
                


    </div>
</div>
                    
                    

                </div>
            </div>
        </div>


         
<%@include file="./include/footer.jsp"%>

    </div>
</div>


</body>

    <!--   Core JS Files   -->
    <script src="${pageContext.request.contextPath}/js/jquery-1.10.2.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>

	<!--  Checkbox, Radio & Switch Plugins -->
	<script src="${pageContext.request.contextPath}/js/bootstrap-checkbox-radio-switch.js"></script>

	<!--  Charts Plugin -->
	<script src="${pageContext.request.contextPath}/js/chartist.min.js"></script>

    <!--  Notifications Plugin    -->
    <script src="${pageContext.request.contextPath}/js/bootstrap-notify.js"></script>

    <!-- Light Bootstrap Table Core javascript and methods for Demo purpose -->
	<script src="${pageContext.request.contextPath}/js/light-bootstrap-dashboard.js"></script>

	<!-- Light Bootstrap Table DEMO methods, don't include it in your project! -->
	<script src="${pageContext.request.contextPath}/js/demo.js"></script>

</html> 